﻿@using Telerik.Web.Mvc.UI
@model Leffaetsin.Views.Home.Models.HomeModel
<!DOCTYPE html>
<html lang="en">
<head>
    <title>ASP.NET Web API</title>
    <link href="../../Content/Site.css" rel="stylesheet" />
    
    
    
    
    <script type="text/javascript">
        
        /*
        $(document).ready(function () {
                // Send an AJAX request
                $.getJSON("api/movies/",
                function (data) {
                    // On success, 'data' contains a list of products.
                    $.each(data, function (key, val) {

                        // Format the text to display.
                        var str = val.Name + ': ' + val.Rating + ", " + val.ShowTimes;

                        // Add a list item for the product.
                        $('<li/>', { text: str })
                        .appendTo($('#products'));
                    });
                });
            });
            
            function find() {
                var id = $('#prodId').val();
                $.getJSON("api/products/" + id,
                    function (data) {
                        var str = data.Name + ': $' + data.Price;
                        $('#product').text(str);
                    })
                .fail(
                    function (jqXHR, textStatus, err) {
                        $('#product').text('Error: ' + err);
                    });
            }
            */
        </script>

</head>
<body id="body" >
    <div class="main-content">
        
            <h1>All movies</h1>
        
        
        
        Movies for @DateTime.Now.ToShortDateString() for place 1014 (Pääkaupunkiseutu)
        
        @(Html.Telerik().Grid(Model.Movies)
        .Name("Grid")
        .Columns(columns =>
                     {
                         columns.Bound(o => o.Title);
                         columns.Bound(o => o.OriginalTitle);
                         columns.Bound(o => o.StrippedTitle);
                         columns.Bound(o => o.Rating);
                         columns.Bound(o => o.ProductionYear);
                         columns.Bound(o => o.ApiUrl);
                     }).Sortable()
              ) 
    </div>
</body>
</html>